package com.qf.service;

import com.qf.dao.DqEntitiesMapper;
import com.qf.dto.TreeDTO;
import com.qf.pojo.DqEntities;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * //                       .::::.
 * //                     .::::::::.
 * //                    :::::::::::  come on
 * //                 ..:::::::::::'
 * //              '::::::::::::'
 * //                .::::::::::
 * //           '::::::::::::::..
 * //                ..::::::::::::.
 * //              ``::::::::::::::::
 * //               ::::``:::::::::'        .:::.
 * //              ::::'   ':::::'       .::::::::.
 * //            .::::'      ::::     .:::::::'::::.
 * //           .:::'       :::::  .:::::::::' ':::::.
 * //          .::'        :::::.:::::::::'      ':::::.
 * //         .::'         ::::::::::::::'         ``::::.
 * //     ...:::           ::::::::::::'              ``::.
 * //    ```` ':.          ':::::::::'                  ::::..
 * //                       '.:::::'                    ':'````..
 * //
 *
 * @author:小川
 * @date: 2018/11/24 11:10
 */
@Service
public class DqEntityServiceImpl implements DqEntityService {
    @Autowired
    private DqEntitiesMapper dqEntitiesMapper;
    @Override
    public List<TreeDTO> findAll() {
        List<TreeDTO> list=new ArrayList<>();
        List<DqEntities> dqEntities = dqEntitiesMapper.selectByExample(null);
        for (DqEntities dqEntity : dqEntities) {
            TreeDTO treeDTO=new TreeDTO();
            treeDTO.setId(dqEntity.getOwnerId());
            treeDTO.setText(dqEntity.getOwnType());
            treeDTO.setStatus("open");
            list.add(treeDTO);
        }
        return list;
    }
}
